<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h3>时间:{{date.dateFormate('yyyy-mm-dd')}}</h3>
        <h3>时间:{{date.dateFormate('yyyy年mm月dd日')}}</h3>
        <h3>时间{{date|filterDate('yyyy-mm-dd')}}</h3>
        <h4>老师的名称 {{list|filterList}}</h4>
    </div>
    
</body>
<script>
Date.prototype.dateFormate = function(str){
    let year = this.getFullYear();
    let month = this.getMonth()+1;
    let day = this.getDate();

    return  str.replace("yyyy",year).replace("mm",month).replace("dd",day);
}

    new  Vue({
        el:"#app",
        data:{
            date:new  Date(),
            list:[{id:1,name:"leson"},{id:2,name:"lala"}]
        },
        filters:{//过滤器
            filterDate(date,str){
                return  date.dateFormate(str);

            },
            filterList(list){
                return  list.map(item=>item.name).join("-");

            }


        }
    })



</script>
</html>